import sys
from typing import List


def func(nums: List) -> int:
    if len(nums) < 2:
        return sum(nums)
    dp = [0] * len(nums)
    dp[0], dp[1] = nums[0], max(nums[:2])
    for i in range(2, len(nums)):
        dp[i] = max(dp[i-2]+nums[i], dp[i-1])
    return dp[-1]


if __name__ == '__main__':
    nums = sys.stdin.readline().strip()
    nums = nums.split(',')
    nums = list(map(int, nums))
    print(func(nums))
